#include <iostream>
#include <cmath>

using namespace std;

bool isPrime(int x)
{
	for(int i = 2; i <= sqrt(x); i++)
	{
		if(x % i == 0)
			return false;
	}
	return true;
}

int reverseNum(int x)
{
	int tmp = x;
	int ret = 0;
	while(tmp)
	{
		ret = ret * 10 + tmp % 10;
		tmp /= 10;
	}
	return ret;
}

int main()
{
	int M, N;
	cin >> M >> N;
	int flag = 0;
	for(int i = M; i <= N; i++)
	{
		int i2 = reverseNum(i);
		if(isPrime(i) && isPrime(i2) )
		{
			if(flag)
				cout << ',';
			cout << i;
			flag++;
		}	
	}
	if(flag == 0)
		cout << "No" << endl;
	return 0;
 } 
